package com.aier.admin_new.entity.mapper;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Map;

import net.eicp.ghostboy.futil.StringUtil;

import org.springframework.jdbc.core.RowMapper;

import com.aier.admin_new.entity.RoleUsers;
import com.aier.school.entity.SchoolInfoDetail;

public class RoleUsersMapper implements RowMapper<RoleUsers>{

	   private int type;
	   
	public RoleUsersMapper() {
	}

	public RoleUsersMapper(int type) {
		this.type = type;
	}

	@Override
	public RoleUsers mapRow(ResultSet rs, int arg1) throws SQLException {
		
		return parseSchoolInfo(new RoleUsers(), rs);
	}

	private RoleUsers parseSchoolInfo(RoleUsers roleUsers, ResultSet rs) {
		return parseSchoolInfo(roleUsers, rs, null);
	}

	private RoleUsers parseSchoolInfo(RoleUsers roleUsers, ResultSet rs,
			String su) {
		 if (StringUtil.isStringNull(su)) {
	            su = "";
	        } else {
	            su += ".";
	        }
		 try {
			roleUsers.setId(rs.getInt(su+"id"));
			roleUsers.setRid(rs.getInt(su+"rid"));
			roleUsers.setUid(rs.getInt(su+"uid"));
			roleUsers.setSid(rs.getInt(su+"sid"));
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return roleUsers;
	}
	 public static Map<String, Object> getPar(Map<String, Object> par, RoleUsers si) {
	        par.put("id", si.getId());
	        par.put("rid",si.getRid());
	        par.put("uid", si.getUid());
	        par.put("sid",si.getSid());
	        return par;
	    }
}